<?php
require_once dirname(__FILE__) . '/includes/common.inc.php';
require_once dirname(__FILE__) . "/database/$database/database.inc.php";

header('Content-Type: text/plain');

global $myManager;

try {
  $hostname = HOST_NAME;
  $username = USER_NAME1;
  $password = PASSWORD1;
  $dbname = DATABASE_NAME1;
  $myPdo = new PDO ('mysql:host=' . $hostname, $username, $password);
  $myPdo->exec('USE ' . $dbname);
  $myPdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (PDOException $e) {
  echo $e->getMessage ();
}

try {
  $sql = "update ns_customer as c set c.createdDate = c.createdDate + 18000 where c.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_customer as c set c.cancelledDate = c.cancelledDate + 18000 where c.cancelledDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_datezone as d set d.start = d.start + 18000 where d.start != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_datezone as d set d.end = d.end + 18000 where d.end != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_expense as e set e.createdDate = e.createdDate + 18000 where e.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_expense as e set e.payDate = e.payDate + 18000 where e.payDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_expense as e set e.cancelledDate = e.cancelledDate + 18000 where e.cancelledDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_myorder as mo set mo.createdDate = mo.createdDate + 18000 where mo.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_myorder as mo set mo.date = mo.date + 18000 where mo.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_myordercancel as moc set moc.date = moc.date + 18000 where moc.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_payment as p set p.createdDate = p.createdDate + 18000 where p.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_payment as p set p.date = p.date + 18000 where p.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_payment as p set p.cancelledDate = p.cancelledDate + 18000 where p.cancelledDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_purchasenote as pn set pn.date = pn.date + 18000 where pn.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  echo json_encode(array());
} catch (PDOException $e) {
  echo $e->getMessage();
}
?>